<?
/*
    HerbalWorkshop. Web database of herbals and oils, recipes and their effects.
    Copyright (C) 2009  Nikolay Gniteev godhart@gmail.com

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

// Load Template
	$T = new Blitz('browse.tpl');
	
// Get browse type
	$browse_type=0; if (array_key_exists('browse',$_GET)) {$browse_type=$_GET['browse'];}

	define("bt_main", 0);
	define("bt_lib", 1);
	define("bt_users", 2);
	
	define("nm_MainPage", 'Основная страница');
	define("nm_Library", 'Библиотека');
	define("nm_Users", 'Пользователи');
	
	define("s_contents", 'Содержит');
	define("s_about_item", 'Информация об элементе');
	define("s_root", 'Корень библиотеки');
	define("s_pages", 'Страницы');
	
	
	define("nm_lib", 'Библиотека');
	define("nm_pkg", 'Пакет');
	define("nm_unit", 'Компонент');

// Environment
	$MainPageRef = 'index.php';
	$EditPageRef = 'edit.php';
	
// Titles and Menu Set
	$Title="VHDL Library Main Page";
	$WebSiteName="VHDL Library";
	$PageTag="";
	$Menu = array (
	    'Menu' => array(
	        0 => array('item' => nm_MainPage, 'ref' => $MainPageRef, 'is_top' => '1', 'is_child' => '0'),
	        1 => array('item' => nm_Library, 'ref' => $MainPageRef."?browse=".bt_lib, 'is_top' => '0', 'is_child' => '0'),
	        2 => array('item' => nm_Users, 'ref' => $MainPageRef."?browse=".bt_users, 'is_top' => '0', 'is_child' => '0')
	    )
	);
		
	if ($browse_type==bt_lib) 
	{
		$Title="VHDL Library Browser";
		$PageTag=nm_Library;
		$Menu = array (
		    'Menu' => array(
		        0 => array('item' => nm_MainPage, 'ref' => $MainPageRef, 'is_top' => '0', 'is_child' => '0'),
		        1 => array('item' => nm_Library, 'ref' => $MainPageRef."?browse=".bt_lib, 'is_top' => '1', 'is_child' => '0'),
		        2 => array('item' => nm_Users, 'ref' => $MainPageRef."?browse=".bt_users, 'is_top' => '0', 'is_child' => '1')
		    ));		
	}
	if ($browse_type==bt_users)
	{
		$Title="Users Browser";
		$PageTag=nm_Users;		
		$Menu = array (
		    'Menu' => array(
		        0 => array('item' => nm_MainPage, 'ref' => $MainPageRef, 'is_top' => '0', 'is_child' => '0'),
		        1 => array('item' => nm_Library, 'ref' => $MainPageRef."?browse=".bt_lib, 'is_top' => '0', 'is_child' => '0'),
		        2 => array('item' => nm_Users, 'ref' => $MainPageRef."?browse=".bt_users, 'is_top' => '1', 'is_child' => '0')
		                
		    ));
	}
	
	$T->set($Menu);
	
// Set Content
	if ($browse_type==bt_main)
	{
		$Welcome = array ( 'Welcome' => array (
			'WelcomeTitle' => 'Добро пожаловать в проводник библиотеки VHDL',
			'MainWelcomeMessage' => 'Этот сайт предоставляет удобную навигацию по библиотеке VHDL. Have Fun :)',
			'SubTitle' => 'Under Construction',
			'SubMessage' => 'На данный момент сайт находится в стадии разработки, поэтому, как говорится, на свой страх и риск...'
		));
		$T->set($Welcome);
		
		$AnounceTitle="Интересного на сайте";
		$Anounces = array ('Anounces' => array(
			0 => array('Anounce'=>'Пока ничего...')
		));			
		$T->set($Anounces);
		
	}
	
	if ($browse_type==bt_lib)
	{
		$Fields = '';
		$Table = '';
		
		$ObjectBrowser = array ('ObjectBrowser'=> array(
					'Title' => 'Root',
					'Path' => '\\',
					'Info' => s_root,
					's_contents' => s_contents,
					'Content' => array(
						0 => array('Item'=>'IEEE','ItemRef'=>'IEEE_ref','ItemType'=>nm_lib),
						1 => array('Item'=>'TTI','ItemRef'=>'TTI_ref','ItemType'=>nm_pkg),
						2 => array('Item'=>'KEY','ItemRef'=>'TTI_ref','ItemType'=>nm_unit),
					),
					'Pages' => array ('s_pages'=>s_pages,'Page'=>array(
						0 => array ('PageLink'=>'p1','Page'=>'1'),
						1 => array ('PageLink'=>'p2','Page'=>'2'),
						2 => array ('PageLink'=>'p3','Page'=>'3'),
						3 => array ('skip'=>'1'),
						4 => array ('PageLink'=>'p10','Page'=>'10'),
						)),
					'ItemData' => array('s_about_item' => s_about_item, 'ItemData'=>'blablabla....<br />blablabla...'),
					'ObjectOperations' => array( 'Operation'=> array(
						0=>array('Name'=>'Add','Text'=>' Добавить '))
					)
		));
		
		$T->set($ObjectBrowser);
		 		
		$AnounceTitle="Последние события";
		$Anounces = array ('Anounces' => array(
			0 => array('Anounce'=>'Пока ничего не поступало...'),
			1 => array('Anounce'=>'Все тихо...'),
			2 => array('Anounce'=>'Библиотека пустая...')
		));			
		$T->set($Anounces);
	}
	
	if ($browse_type==bt_users)
	{
		$Fields = '';
		$Table = '';
		 		
		$AnounceTitle="Информация";
		$Anounces = array ('Anounces' => array(
			0 => array('Anounce'=>'Пока нет пользователей...')
		));			
		$T->set($Anounces);
	}
	
	$T->set(array('LoginBar'=>'Когда нибудь здесь будет Login'));	
//	if ($browse_type!=bt_main) $T->set(array('SearchBar'=>'Здесь будет поиск...'));
	
	echo $T->parse(Array('Title'=>$Title,'WebSiteName'=>$WebSiteName,'PageTag'=>$PageTag,'AnounceTitle'=>$AnounceTitle));
	
?>